package com.education.welco.mapper;

import com.education.welco.pojo.STheoryClassroom;
import com.education.welco.pojo.TClass;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 理论课堂 数据层
 *
 * @author d
 * @date 2020-05-11
 */
@Repository
public interface STheoryClassroomMapper {

    /**
     * 查询理论课堂信息
     *
     * @param id 理论课堂ID
     * @return 理论课堂信息
     */
    public STheoryClassroom selectSTheoryClassroomById(Integer id);


    /**
     * 查询理论课堂信息
     *
     * @param id 理论课堂ID
     * @return 理论课堂信息
     */
    public STheoryClassroom selectSTheoryClassroomByIdOther(Integer id);

    /**
     * 统计总数
     *
     * @param userId 理论课堂ID
     * @return 理论课堂信息
     */
    public Integer selectSTheoryClassroomCount(@Param("userId") Integer userId);

    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    public List<STheoryClassroom> selectSTheoryClassroomList(STheoryClassroom sTheoryClassroom);


    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    public List<STheoryClassroom> selectSTheoryClassroomListOther(STheoryClassroom sTheoryClassroom);

    public List<STheoryClassroom> selectPaikeList(STheoryClassroom sTheoryClassroom);


    /**
     * 查询理论课堂列表
     *
     * @param map 理论课堂信息
     * @return 理论课堂集合
     */
    public List<STheoryClassroom> selectSTheoryClassroomListOtherTwo(Map<String, Object> map);

    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    public List<STheoryClassroom> selectSTheoryClassroomListByClassroomAndTime(STheoryClassroom sTheoryClassroom);

    /**
     * 查询理论课堂列表
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 理论课堂集合
     */
    public List<Integer> selectSTheoryClassroomListByTime(STheoryClassroom sTheoryClassroom);

    /**
     * 新增理论课堂
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 结果
     */
    public int insertSTheoryClassroom(STheoryClassroom sTheoryClassroom);

    /**
     * 修改理论课堂
     *
     * @param sTheoryClassroom 理论课堂信息
     * @return 结果
     */
    public int updateSTheoryClassroom(STheoryClassroom sTheoryClassroom);

    /**
     * 删除理论课堂
     *
     * @param id 理论课堂ID
     * @return 结果
     */
    public int deleteSTheoryClassroomById(Integer id);

    /**
     * 批量删除理论课堂
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteSTheoryClassroomByIds(String[] ids);

    List<TClass> selectSTheoryClassroomListByTimeAndIn(STheoryClassroom theoryClassroom);

    Integer selectClassStuNumByCatalogId(@Param("catalogId") Integer catalogId);

    /**
     * 根据课程id获取相关联的班级id集合
     *
     * @param catalogId
     * @return
     */
    List<Integer> selectClassIdsByCatalogId(Integer catalogId);

    /**
     * 为解绑班级的设备查找当前时刻下该班级是否有直播课
     *
     * @param classroomId 班级id
     * @param nowDate     当前时刻
     * @return
     */
    List<STheoryClassroom> selectSTheoryClassroomListForNowLive(@Param("classroomId") Integer classroomId, @Param("nowDate") Date nowDate);

    /**
     * 查找老师所带的直播课堂
     *
     * @param teaUserId
     * @return
     */
    List<STheoryClassroom> selectTeaCourseListByTeaId(@Param("teaUserId") Integer teaUserId);
}